package com.mygdx.game.Stage.Fight.Card;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.mygdx.game.Scenes.ActiveCharacter;
import com.mygdx.game.Stage.Fight.Energy;
import com.mygdx.game.Stage.Fight.Fighter;

import java.util.ArrayList;


public class Card extends Actor{
    public int level = 1;           //卡牌的等级，升级后属性有提升
    public int cost=1;             //卡牌的消耗值

    //卡牌的大小和图片
    public float x=0;
    public float y=0;
    public static float width;
    public static float height;
    public String image ;

    public Texture texture;

    public Card(String path){
        super();
        image = path;
        show();
    }

    public void levelUP(){
        level++;
    }

    public boolean effect(Energy energy, Fighter mainActor, ArrayList<Fighter> enemies){
        return true;
    }

    public void show(){
        texture = new Texture(Gdx.files.internal(image));       //给卡牌具体的图片路径
        width = texture.getWidth();
        height = texture.getHeight();
    }

    @Override
    public void setPosition(float x, float y) {
        this.x=x;
        this.y=y;
    }

    @Override
    public void draw(Batch batch, float parentAlpha){
        moveNextCardPosition();
        batch.draw(texture,x,y);
    }

    @Override
    public void act(float delta) {
        super.act(delta);
    }

    public void setCardPosition(int i){
        switch (i){
            case 0:setPosition(0,0);break;
            case 1:setPosition(300,0);break;
            case 2:setPosition(600,0);break;
            case 3:setPosition(900,0);break;
            case 4:setPosition(1200,0);break;
            case 5:setPosition(1500,0);break;

        }
    }

    private void moveNextCardPosition(){
        if (x%300!=0){
            setPosition(x-5,y);
        }
    }

    public void startmoveNextCardPosition(){
        setPosition(x-5,y);
    }

    @Override
    public String toString() {
        return "Card{" +
                "x=" + x +
                ", y=" + y +
                '}';
    }
}
